﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;

namespace Luka;

/// <summary>
/// 自定义 Startup 扩展类
/// </summary>
[NotScanned]
public sealed class StartupFilter : IStartupFilter
{
    public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next)
    {
        return app =>
        {
            app.Use(async (httpContext, _next) =>
            {
                await _next(httpContext);
            });
            // 存储根服务
            InternalApp.RootServices = app.ApplicationServices;
            next(app);
        };
    }
}